package com.sds.book.nacos.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 01420175
 * @since 2024/3/12
 */
@NacosPropertySource(dataId = "example", autoRefreshed = true)
@RestController
public class TestController {

    @NacosValue(value = "${info:Local Hello World}", autoRefreshed = true)
    private String info;

    @GetMapping("/config")
    public String discovery() throws NacosException {
        return info;
    }

}
